﻿@page "/SiemensS7Master"
@using ThingsGateway.Core.Extension
@using ThingsGateway.Foundation
@namespace ThingsGateway.Demo
@using ThingsGateway.Foundation.SiemensS7
@using TouchSocket.Core
@inherits BaseComponentBase
<DemoChannelPage OnConnectClick="OnConnectClick" OnEditClick="OnEditClick"></DemoChannelPage>

@if (_plc != null)
{
    <MCard Class="ma-2">
        <MSubheader Style="max-height:32px">
            @AppService.I18n.T("Adapter Config")
        </MSubheader>
        <MContainer Class="ma-0">

            <MRow Justify="JustifyTypes.Start" Align="AlignTypes.Center">

                <MSelect Class="ma-1" Outlined Style="max-width:200px"
                          @bind-Value="_plc.SiemensType" Label="@(AppService.I18n.T(_plc.Description(x => x.SiemensType)))"
                          Items=@(typeof(SiemensTypeEnum).GetEnumList())
                          MenuProps="@(props => { props.Auto = true; props.OffsetY = true; })"
                          ItemText=@(u =>u.Description)
                          ItemValue=@(u =>(SiemensTypeEnum)u.Value)
                          HideDetails=@("auto") Height="30"
                      Dense>
             </MSelect>

             <MTextField Class="ma-1" Outlined Style="max-width:150px" Dense HideDetails="@("auto")"
                             Label=@(AppService.I18n.T(_plc.Description(x => x.ConnectTimeout))) @bind-Value=@_plc.ConnectTimeout></MTextField>
                 <MTextField Class="ma-1" Outlined Style="max-width:150px" Dense HideDetails="@("auto")"
                             Label=@(AppService.I18n.T(_plc.Description(x => x.Timeout))) @bind-Value=@_plc.Timeout></MTextField>

                 <MTextField Class="ma-1" Outlined Style="max-width:150px" Dense HideDetails="@("auto")"
                             Label=@(AppService.I18n.T(_plc.Description(x => x.SendDelayTime))) @bind-Value=@_plc.SendDelayTime></MTextField>
                 <MTextField Class="ma-1" Outlined Style="max-width:150px" Dense HideDetails="@("auto")"
                             Label=@(AppService.I18n.T(_plc.Description(x => x.CacheTimeout))) @bind-Value=@_plc.CacheTimeout></MTextField>

                 <MTextField Class="ma-1" Outlined Style="max-width:150px" Dense HideDetails="@("auto")"
                             Label=@(AppService.I18n.T(_plc.Description(x => x.LocalTSAP))) @bind-Value=@_plc.LocalTSAP></MTextField>

                 <MTextField Class="ma-1" Outlined Style="max-width:150px" Dense HideDetails="@("auto")"
                             Label=@(AppService.I18n.T(_plc.Description(x => x.Rack))) @bind-Value=@_plc.Rack></MTextField>

                 <MTextField Class="ma-1" Outlined Style="max-width:150px" Dense HideDetails="@("auto")"
                             Label=@(AppService.I18n.T(_plc.Description(x => x.Slot))) @bind-Value=@_plc.Slot></MTextField>


                 <MSelect Class="ma-1" Outlined Style="max-width:200px"
                          @bind-Value="_plc.DataFormat" Label="@(AppService.I18n.T(_plc.Description(x => x.DataFormat)))"
                          Items=@(typeof(DataFormatEnum).GetEnumList())
                          MenuProps="@(props => { props.Auto = true; props.OffsetY = true; })"
                          ItemText=@(u =>u.Description)
                          ItemValue=@(u =>(DataFormatEnum)u.Value)
                          HideDetails=@("auto") Height="30"
                      Dense>
             </MSelect>


             </MRow>
         </MContainer>
     </MCard>
}

<AdapterDebugPage LogPath=@LogPath @ref=AdapterDebugPage Height=@($"calc(100vh - {BlazorAppService.DefaultHeight+400}px)")></AdapterDebugPage>


